package com.oa.gform.client.ui;

import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.oa.gform.client.validator.bundle.GFormBundle;

/**
 * 
 * Descrizione Html con icona
 * 
 * <h3>CSS Style Rules</h3>
 * <ul class='css'>
 * <li>.GForm-Description { }</li>
 * <li>.GForm-Description-Html { }</li>
 * </ul>
 * 
 * @author Marco Prisco
 *
 */

public class GDescription extends HorizontalPanel  {
	public String name; 

	HTML html = new HTML();
	private String htmlText; 
	private static final String styleName = "GForm-Description";
	private static final String styleNameHtml = "GForm-Description-Html";
	
	//TODO Documentazione
	public GDescription(String htmlText) {
		this.setVerticalAlignment(ALIGN_MIDDLE);
		this.htmlText = htmlText;
		this.add(new Image(GFormBundle.getCommonIcon().descriptionInfoIcon()));
		initUI();
		this.add(new HTML());
	
	}

	//TODO Documentazione
	public GDescription(Image image,String htmlText) {
		this.setVerticalAlignment(ALIGN_MIDDLE);
		this.htmlText = htmlText;
		this.add(image);
		initUI();
	}
	
	//TODO Documentazione
	public GDescription(ImageResource image,String htmlText) {
		this.setVerticalAlignment(ALIGN_MIDDLE);
		this.htmlText = htmlText;
		this.add(new Image(image));
		initUI();
	}
	
	/***
	 * Inizializza l'interfaccia grafica del componente
	 */
	private void initUI() {
		this.setStyleName(styleName);
		html.setHTML(htmlText);
		html.setStyleName(styleNameHtml);
		this.add(html);
		this.setSpacing(5);
	}
	


	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
